<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.8.3.min.js"></script>
    <script src="../../js/env.js"></script>
    <title>新增充电桩</title>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title"  >
    <legend id="aaa">新增充电桩</legend>
</fieldset>
<div class="demoTable">
    <button type="button" class="layui-btn" style="margin-left: 10px;margin-bottom: 10px" onclick="javascript :history.back(-1)">返回</button>
</div>
<br>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">编号</label>
        <div class="layui-input-block">
            <input type="text"   id="serialNumber"   autocomplete="off" placeholder="请输入编号" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">车位号</label>
        <div class="layui-input-block">
            <input type="text"   id="parkingLotNo"   autocomplete="off" placeholder="请输入车位号" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">功率</label>
        <div class="layui-input-block">
            <input type="text"   id="rateOfWork"   autocomplete="off" placeholder="请输入功率" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类型</label>
        <div class="layui-input-block">
            <select id="acDc" lay-filter="acDc">
                <option value="">请选择</option>
                <option value="1">直流</option>
                <option value="2">交流</option>

            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">开放开始时间</label>
        <div class="layui-input-block">
            <input type="text"   id="date1"   autocomplete="off" placeholder="yyyy-MM-dd" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">开放结束时间</label>
        <div class="layui-input-block">
            <input type="text"   id="date2"   autocomplete="off" placeholder="yyyy-MM-dd" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">价格元/度</label>
        <div class="layui-input-block">
            <input type="text"   id="price"   autocomplete="off" placeholder="请输入价格" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">服务费元/度</label>
        <div class="layui-input-block">
            <input type="text"   id="serviceCharge"   autocomplete="off" placeholder="请输入服务费" class="layui-input">
        </div>
    </div>
    <button class="layui-btn"  style="margin:0 50%;" onclick="sub()" data-method="offset" type="button" align="center">保存 </button>
</form>

</body>
<script>
    if(layui.sessionData('user').userInfo===undefined){
        window.location.href = "../html/login.html"
    }
    layui.use(['form', 'layedit', 'laydate','upload'], function() {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;
        var upload = layui.upload;
        //日期
        laydate.render({
            elem: '#date1',
            type:"time"
        });
        laydate.render({
            elem: '#date2',
            type:"time"
        });

    });
    function sub(){
        var param={};
        param.chargingStationsId=getParam("chargingStationsId");
        param.parkingLotNo=$("#parkingLotNo").val();
        param.serialNumber=$("#serialNumber").val();
        param.rateOfWork=$("#rateOfWork").val();
        param.acDc=$("#acDc").val();
        param.openStartTime=$("#date1").val();
        param.openEndTime=$("#date2").val();
        param.price=$("#price").val();
        param.serviceCharge=$("#serviceCharge").val();
      var response=  MyAjax("POST","/admin/chargeStation/addAndEditChargingPileInfo",param,getToken());
      if(response.code===0){
          layer.msg("保存成功");
          setTimeout(function () {
              history.back(-1)
          },500)
      }
    }


</script>
</html>